<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <form>
      <input type="text" v-model="name">
      <input type="text" v-model="pwd">
      <button type="button" @click="login">登录</button>
    </form>
    <Test/>
    <input type="text" v-model="number">
    <p>导航
    <router-link to="/">首页</router-link>
    <router-link to="/login">登录</router-link>
    <router-link to="/userList">用户列表</router-link>
    <router-link to="/bookList">图书列表</router-link>
    </p>

    <el-button @click="toRegist" type="danger">注册</el-button>

    输入框的值是{{number}}
  </div>
</template>

<script>
// 引用其他组件：引入 注册 定义
import Test from './HelloTest'
import User from './UserList'
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'PRTS OS',
      name: '',
      pwd: '',
      number: 20
    }
  },
  components: {Test, User},
  methods: {
    login: function () {
      console.info(this.name)
      console.info(this.pwd)
      // this.$axios.get('/api/admin/login', {params: {loginName: this.name, password: this.pwd}}).then().catch().finally
    },
    toRegist: function () {
      this.$router.push({path: '/regist'})
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
